import React, { Component } from 'react'
import {connect} from "react-redux"
import {addNum} from "../reducers/numReducer"

 class About extends Component {
  render() {
    return (
      <div>
        <div>全局的数据为{this.props.num}</div>
        <button onClick={()=>{
                this.props.addNum(101);
            }}>修改数据</button>
      </div>
    )
  }
}
// let mapStateToProps =(state)=>{
//     return  {
//         num:state.numInfo.num
//     }

// } 

let mapStateToProps = ({numInfo})=>({num:numInfo.num})

let  mapDispatchToProps = {
    addNum
}

export  default  connect(mapStateToProps,mapDispatchToProps)(About)
